﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using KaoQin.DBUtility;
using System.Data;
using System.Data.SQLite;

namespace KaoQin.ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                //string input = "aasdfzdfdfdfzzz";
                //string result = Regex.Replace(input, "[z]{1,}$", "");
                //Console.WriteLine(result);
                string connString = "Data Source=KaoQin.db;Password=123;";
                SQLiteHelper.ConnString = connString;

                List<SQLiteParameter> paras = new List<SQLiteParameter>();
                SQLiteParameter sp = new SQLiteParameter();
                sp.DbType = DbType.Int32;
                sp.ParameterName = "ID";
                sp.Value = 1;
                paras.Add(sp);
                DataSet ds = SQLiteHelper.Query("select * from employee where ID=@ID",paras.ToArray());

                if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    Console.WriteLine(ds.Tables[0].Rows[0][0]);
                    Console.WriteLine(ds.Tables[0].Rows[0][1]);
                }
                else
                {
                    Console.WriteLine("没有读取到数据");
                }
                
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.ReadLine();
            }
            

        }
    }
}
